local leqi = fk.CreateSkill {
    name = "jinhs__leqi",
    tags = { Skill.Limited },
}

Fk:loadTranslationTable {
    ["jinhs__leqi"] = "勒启",
    [":jinhs__leqi"] = "限定技，出牌阶段，你可以令一名有暗置武将牌的其他角色明置一张武将牌，若其与你势力不同，你对其造成1点伤害；否则你与其各摸两张牌。",

    ["#jinhs__leqi"] = "勒启：选择一名有暗置武将牌的角色，明置一张武将牌",

    ["$jinhs__leqi1"] = "各位出来吧，好戏即将开场！",
    ["$jinhs__leqi2"] = "三分天下，将一统于朕手。",
}

local H = require "packages/ol_hegemony/util"

leqi:addEffect("active", {
    anim_type = "special",
    prompt = "#jinhs__leqi",
    can_use = function(self, player)
        return player:usedSkillTimes(leqi.name, Player.HistoryGame) == 0
    end,
    target_num = 1,
    card_num = 0,
    card_filter = Util.FalseFunc,
    target_filter = function(self, player, to_select, selected, selected_cards)
        return #selected == 0 and not H.allGeneralsRevealed(to_select) and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local to = effect.tos[1]
        if player.dead or to.dead then return end
        local flag
        if to.general == "unknown" then
            flag = "m"
        elseif to.deputyGeneral == "unknown" then
            flag = flag .. "d"
        end
        H.askToRevealGenerals(to, {
            flag = flag,
            skill_name = leqi.name,
            revealAll = false,
            cancelable = false,
        })
        if H.compareKingdomWith(to, player) then
            player:drawCards(2, leqi.name)
            to:drawCards(2, leqi.name)
        else
            room:damage {
                from = player,
                to = to,
                damage = 1,
                skillName = leqi.name,
            }
        end
    end,

})


return leqi
